package com.fiberhome.nas.core.data.repository

import com.fiberhome.nas.core.model.entity.AlbumInfo
import com.fiberhome.nas.core.model.response.ListData
import com.fiberhome.nas.core.model.response.NetworkResponse
import com.fiberhome.nas.core.network.datasource.album.AlbumNetworkDataSource
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.flowOn
import javax.inject.Inject

/**
 * 相册相关仓库
 */
class AlbumRepository @Inject constructor(
    private val albumNetworkDataSource: AlbumNetworkDataSource
) {

    /**
     * 获取相册列表
     */
    fun getAlbumList(): Flow<NetworkResponse<ListData<AlbumInfo>>> = flow {
        emit(albumNetworkDataSource.getAlbumList())
    }.flowOn(Dispatchers.IO)

}